create proc sp_formdangkylop_loadcbokhoahoc
as
	select * from KhoaHoc
go

create proc sp_formdangkylop_loadcbolop
@makhoa nchar(10)
as
	select Lop .MaLop, TenLop  from ChiTietLop, Lop
	where ChiTietLop.MaLop = Lop .MaLop and MaKhoa = @makhoa
	group by Lop .MaLop, TenLop
go

create proc sp_formdangkylop_loaddgvdanhsach
@malop nchar(10)
as
	select HocVien .MaHocVien, TenHocVien
	from DangKiLop, HocVien
	where DangKiLop . MaHocVien = HocVien .MaHocVien and MaLop = @malop 
go

create proc sp_formdangkylop_loadthongtinlop
@malop nchar(10)
as
	select MonHoc.MaMon, Lop.MaLop, TenLop, TenMon, HocPhi
	from MonHoc, ChiTietLop, Lop
	where MonHoc.MaMon = ChiTietLop.MaMon and ChiTietLop.MaLop = Lop.MaLop and Lop.MaLop = @malop
go

create proc sp_formdangkylop_insertdangkylop
@malop nchar(10),
@mahocvien nchar(10)
as
	insert into DangKiLop
	values (@mahocvien, @malop)
go
create proc sp_formdangkylop_deletedangkylop
@malop nchar(10),
@mahocvien nchar(10)
as
	delete from DangKiLop
	where MaLop = @malop and MaHocVien = @mahocvien
go




